local function main (userOb, msgData)
    if not msgData.key or not msgData.context then
        return
    end

    if type(msgData.key) ~= "string" or #msgData.key > 255 then
        local result = {}
        result.error = 1
        result.key = msgData.key
        result.context = msgData.context
        userOb:send_packet("MSGS2CSet", result)
        return
    end

    if type(msgData.context) ~= "string" or #msgData.context > 4096 then
        local result = {}
        result.error = 2
        result.key = msgData.key
        result.context = msgData.context
        userOb:send_packet("MSGS2CSet", result)
        return
    end

    userOb:set("client_dbase", msgData.key, msgData.context)

    local result = {}
    result.error = 0
    result.key = msgData.key
    result.context = msgData.context
    userOb:send_packet("MSGS2CSet", result)
end

COMMAND_D:register_command("MSGC2SSet", GameCmdType.NONE, main)
